package cn.xiuxius.embedded.toolwindow.model;

import lombok.experimental.Accessors;

import java.util.List;
import java.util.function.Supplier;

@Accessors(chain = true)
public class StringCommandOption extends AbstractCommandOption<String> {

    public StringCommandOption(String cmdFlag, String defaultValue, boolean onlyFlag) {
        super(cmdFlag, defaultValue, onlyFlag);
    }

    @Override
    public AbstractCommandOption<String> options(Supplier<List<String>> provider) {
        super.setOptions(provider.get());
        super.setRefreshProvider(provider);
        return this;
    }

    @Override
    public boolean isValid() {
        return super.getOptions().contains(getCmdValue());
    }

    @Override
    public boolean isValidValue(String value) {
        return super.getOptions().contains(value);
    }
}
